#!/bin/bash

SVN_PATH_ON_DISK="/usr/src/trunk"
TEMP_PATH="/usr/src/submit_temp"
HW_NAME="hw4"
#KERNEL_PATH=$HW_NAME
EXTRA_FILES_PATH="tools/submitters.txt ${HW_NAME}/client.c ${HW_NAME}/common.h ${HW_NAME}/ctrl_channel.c ${HW_NAME}/ctrl_channel.h ${HW_NAME}/data_channel.c ${HW_NAME}/data_channel.h ${HW_NAME}/env.h ${HW_NAME}/Makefile ${HW_NAME}/file.c ${HW_NAME}/file.h ${HW_NAME}/link.c ${HW_NAME}/link.h ${HW_NAME}/list.c ${HW_NAME}/list.h ${HW_NAME}/logger.c ${HW_NAME}/logger.h ${HW_NAME}/message_queue.c ${HW_NAME}/message_queue.h ${HW_NAME}/server.c"
OUTPUT_ZIP="${SVN_PATH_ON_DISK}/submissions/${HW_NAME}_308878438.zip"


cd $SVN_PATH_ON_DISK
#svn update

if [ -d $TEMP_PATH ]; then
	rm -r $TEMP_PATH
fi

rm -rf ${TEMP_PATH}/zip_temp
mkdir -p ${TEMP_PATH}/zip_temp

#svn export $KERNEL_PATH ${TEMP_PATH}/kernel

cp $EXTRA_FILES_PATH ${TEMP_PATH}/zip_temp

#cd $TEMP_PATH/kernel

#bash -c "tar -cvzf ../zip_temp/kernel.tar.gz *"

cd $TEMP_PATH/zip_temp 

bash -c "zip $OUTPUT_ZIP *"

echo "All Done!"
